﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cylin
{
    public interface ICylBehavior
    {
        void Forward();
        void BackWard();
    }

   
    
    public class SingleSolOn : ICylBehavior
    {
        private Output Sol;

        public SingleSolOn(Output output)
        {
            this.Sol = output;
        }


        public void Forward()
        {
            Sol.OutAlignCyl = true;
        }

        public void BackWard()
        {
            Sol.OutAlignCyl = false;
        }
    }

    public enum CylPos
    {
        FWD = 0,
        BWD,
        UNKNOWN,
    }

    public abstract class Cylinder : IUpdate
    {
        ICylBehavior cylAct;

        public CylPos Pos { get; set; }
        
        public virtual void SetCylAct(ICylBehavior newCylAct)
        {
            this.cylAct = newCylAct;
        }

        public virtual void DoForward()
        {
            this.cylAct.Forward();
        }

        public virtual void DoBackward()
        {
            this.cylAct.BackWard();
        }

        public virtual void Update()
        {
            Console.WriteLine("update");
        }

    }

    

    public class SingleCylNoSen : Cylinder
    {
        Output  output;
        int     delay;
        
        public SingleCylNoSen(Output output, int delay)
        {
            this.Pos = CylPos.BWD;
            this.delay = delay;
            this.output = output;
            SetCylAct(new SingleSolOn(this.output));
        }

        public override void Update()
        {
            
            Console.WriteLine("SingleCyl Update ");
        }
    }
}
